package 匿名函数

import 函数表达式.showOnBoard

fun main() {
    val getDiscoutWords = { goodName: String, hour: Int ->
        val currentYear = 2027
        "${currentYear}年,双11${goodName}促销倒计时：$hour 小时"
    }

    showOnBoard("卫生纸", getDiscoutWords)
}

private inline fun showOnBoard(goodsName: String, getDiscountWords: (String, Int) -> String) {
    val hour = (1..24).random()
    println(getDiscountWords(goodsName, hour))
}